<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>订餐车</title>

<link rel="stylesheet" href="o/css/bootstrap.min2.css" type="text/css"
	media="all">
<link rel="stylesheet" href="o/css/font-awesome.min.css" type="text/css"
	media="all" />
<link rel="stylesheet" href="o/css/ionicons.min.css" type="text/css"
	media="all" />
<link rel="stylesheet" href="o/css/owl.carousel.css" type="text/css"
	media="all">
<link rel="stylesheet" href="o/css/owl.theme.css" type="text/css"
	media="all">
<link rel='stylesheet' href='o/css/prettyPhoto.css' type='text/css'
	media='all'>
<link rel="stylesheet" href="o/css/style2.css" type="text/css"
	media="all">
<link rel="stylesheet" href="o/css/custom.css" type="text/css"
	media="all">
<link
	href="http://fonts.googleapis.com/css?family=Great+Vibes%7CLato:100,100i,300,300i,400,400i,700,700i,900,900i"
	rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
	<script src="http://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
	<script src="http://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
	<div class="noo-spinner">
		<div class="spinner">
			<div class="cube1"></div>
			<div class="cube2"></div>
		</div>
	</div>
	<div id="menu-slideout" class="slideout-menu hidden-md-up">
		<div class="mobile-menu">
			<ul id="mobile-menu" class="menu">
				<li><a href="menu/recommand.do">首页</a></li>			
				<li><a href="cart.do?c_id=${sessionScope.custom.c_id}">订餐车</a></li>				
				<li><a href="order.do?c_id=${sessionScope.custom.c_id}">我的订单</a></li>
			</ul>
		</div>
	</div>
	<div class="site">
		<header id="header" class="header header-desktop header-2">
		<div class="top-search">
			<div class="container">
				<div class="row">
					<div class="col-sm-12">
						<form>
							<input type="search" class="top-search-input" name="s"
								placeholder="What are you looking for?" />
						</form>
					</div>
				</div>
			</div>
		</div>
		<div class="container">
			<div class="row">
				<div class="col-md-3">
					<a href="home.jsp" id="logo"> <img class="logo-image"
						src="images/logo.png" alt="客多多" />
					</a>
				</div>
				<div class="col-md-9">
					<div class="header-right">
						<nav class="menu">
						<ul class="main-menu">
							<li><a href="menu/recommand.do">首页</a></li>
							<li><a href="center.jsp">个人中心</a></li>
							<li><a href="order.do?c_id=${sessionScope.custom.c_id}">我的订单</a></li>
						</ul>
						</nav>
						<div class="btn-wrap">
							<div class="mini-cart-wrap">
								<div class="widget-shopping-cart-content">
									<ul class="cart-list">
										<c:set var="count" value="0"></c:set>
										<c:set var="sum" value="0"></c:set>
										<c:set var="tnum" value="0"></c:set>
										<c:forEach items="${cart}" var="exp">
											<li><a href=""> <img src="upimg/${exp.dishPicture}"
													alt="" />${exp.dishName}&nbsp;
											</a> <span class="quantity">${exp.dish_num} ×
													${exp.dishPrice}</span><a href="javascript:void(0);"
												onclick="deleteCart(${exp.cart_id},${exp.c_id})">删除</a></li>
											<c:set var="sum" value="${sum+1}"></c:set>
											<c:set var="count"
												value="${count+exp.dishPrice*exp.dish_num}"></c:set>
											<c:set var="tnum" value="${tnum+exp.dish_num}"></c:set>
										</c:forEach>
									</ul>
									<p class="total">
										<strong>总金额:</strong> <span class="amount">${count}</span>
									</p>
									<p class="buttons">
										<a href="order.do?c_id=${sessionScope.custom.c_id}"
											class="view-cart">查看订单</a> <a href="javascript:void(0);"
											onclick="confirmOrder(${sessionScope.custom.c_id},${count})"
											class="checkout">直接付款</a>
									</p>
								</div>
								<div class="mini-cart">

									<div class="mini-cart-icon" data-count=${sum}>
										<i class="ion-bag"></i>
									</div>
								</div>
							</div>
							<div class="top-search-btn-wrap">
								<div class="top-search-btn">
									<a href="javascript:void(0);"> <i class="ion-search"></i>
									</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		</header>
		<header class="header header-mobile">
		<div class="container">
			<div class="row">
				<div class="col-xs-2">
					<div class="header-left">
						<div id="open-left">
							<i class="ion-navicon"></i>
						</div>
					</div>
				</div>
				<div class="col-xs-8">
					<div class="header-center">
						<a href="" id="logo-2"> <img class="logo-image"
							src="o/images/logo.png" alt="Organik Logo" />
						</a>
					</div>
				</div>
				<div class="col-xs-2">
					<div class="header-right">
						<div class="mini-cart-wrap">
							<a href="cart.do?c_id=1">
								<div class="mini-cart">
									<div class="mini-cart-icon" data-count="2">
										<i class="ion-bag"></i>
									</div>
								</div>
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
		</header>
		<div id="main">
			<div class="section border-bottom pt-2 pb-2">
				<div class="container">
					<div class="row">
						<div class="col-sm-12">
							<ul class="breadcrumbs">
								<li><a href="">首页</a></li>
								<li><a href="cart.do?c_id=${sessionScope.custom.c_id}">订餐车</a></li>
							</ul>
						</div>
					</div>
				</div>
			</div>
			<div class="section pt-7 pb-7">
				<div class="container">
					<div class="row">
						<div class="col-md-8">
							<table class="table shop-cart">
								<tbody align="center">
									<tr class="cart_item">
										<td class="product-remove">删除</td>
										<td class="product-thumbnail">图片</td>
										<td class="product-info">订单详情编号 <span class="sub-title"><td>餐品名称</td></span>
										<td>餐品价格</td>
										<td class="product-quantity">
											<div class="quantity">餐品数量</div>
										</td>
										<td class="product-subtotal"><span class="amount">用户编号</span>
										</td>
									</tr>
									<c:forEach items="${cart}" var="exp">
										<tr class="cart_item">
											<td class="product-remove"><a href="javascript:void(0);"
												onclick="deleteCart(${exp.cart_id},${exp.c_id})">×</a></td>
											<td class="product-thumbnail"><a href="shop-detail.html">
													<img src="upimg/${exp.dishPicture}" alt="">
											</a></td>
											<td class="product-info"><a href="shop-detail.html">${exp.cart_id}</a></td>
											<span class="sub-title"><td>${exp.dishName}</td></span>
											<td>${exp.dishPrice}</td>
											<td class="product-quantity">
												<div class="quantity">
													<input id="qty-${exp.cart_id}" type="number" min="1"
														max="10" value="${exp.dish_num}" size="4"
														class="input-text qty text"
														onclick="editDNum(${exp.cart_id},${exp.c_id})">
												</div>
											</td>
											<td class="product-subtotal"><span class="amount">${exp.c_id}</span>
											</td>
										</tr>
									</c:forEach>
									<tr>
										<td colspan="5" class="actions"><a
											class="continue-shopping" href="food.jsp"> 继续订餐</a> <a
											type="submit" class="update-cart" name="update_cart"
											href="cart.do?c_id=${sessionScope.custom.c_id}">刷新订单</a></td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="col-md-4">
							<div class="cart-totals">
								<table>
									<tbody>
										<tr class="cart-subtotal">
											<th>商品数量</th>
											<td>${sum}件</td>
										</tr>
										<tr class="cart-subtotal">
											<th>餐品总数</th>
											<td>${tnum}件</td>
										</tr>
										<tr class="shipping">
											<th>快递费</th>
											<td>免费</td>
										</tr>
										<tr class="order-total">
											<th>总金额</th>
											<td><strong>${count}元</strong></td>
										</tr>
									</tbody>
								</table>
								<div class="proceed-to-checkout">
									<a href="javascript:void(0);"
										onclick="confirmOrder(${sessionScope.custom.c_id},${count})">立即付款</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- 		<div class="copyright"> -->
		<!-- 			<div class="container"> -->
		<!-- 				<div class="row"> -->
		<!-- 					<div class="col-md-8">Copyright &copy; 2017.Company name All -->
		<!-- 						rights reserved.</div> -->
		<!-- 					<div class="col-md-4"> -->
		<!-- 						<img src="images/footer_payment.png" /> -->
		<!-- 					</div> -->
		<!-- 				</div> -->
		<!-- 			</div> -->
		<!-- 			<a href="cart.do?c_id=1"><div class="backtotop" id="backtotop"></div></a> -->
		<!-- 		</div> -->
	</div>
	<script language="JavaScript">
function deleteCart(cart_id,c_id) {
	if (confirm("是否删除"+cart_id+"号商品？")) {
		alert("删除成功！");
		window.location.href="deleteCart.do?cart_id="+cart_id+"&c_id="+c_id;
	} else {
		alert("删除失败！");
	}
}
function editDNum(cart_id,c_id) {
	var numtext = $("#qty-"+cart_id).val();
	window.location.href="editDNum.do?cart_id="+cart_id+"&c_id="+c_id+"&dish_num="+numtext;
}

function confirmOrder(c_id,oamount) {
	
	alert(c_id);
	var intMonth,intDay,intHours,intMinutes;
	var today;
	today=new Date();
	intMonth=today.getMonth()+1;
	intDay=today.getDate();
	intHours=today.getHours();
	intMinutes=today.getMinutes();
// 	intSeconds=today.getSeconds();
// 	timeString=intMonth+'月'+intDay+'日'+intHours+":"+intMinutes;
// 	alert(timeString);
	Oid=""+c_id+intMonth+intDay+intHours+intMinutes;
	var c = parseInt(Oid);
	alert(c);
	alert(typeof c);
	window.location.href="addOrder.do?c_id="+c_id+"&Oid="+c+"&Oamount="+oamount;
}
//c_id+intMonth+intDay+intHours+intMinutes+intSecond
// /* increase or decrease item */
// var qtyPlus = $('.qty-plus');
// var qtyMinus = $('.qty-minus');
// qtyPlus.on('click',function(){
//     $(this).siblings('.qty').val(parseInt($(this).siblings('.qty').val())+1);
// });

// qtyMinus.on('click',function(){
//     if(parseInt($(this).siblings('.qty').val()) > 1) {
// 		$(this).siblings('.qty').val(parseInt($(this).siblings('.qty').val())-1);
// 	}
// });
</script>
	<script type="text/javascript" src="o/js/jquery.min.js"></script>
	<script type="text/javascript" src="o/js/jquery-migrate.min.js"></script>
	<script type="text/javascript" src="o/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="o/js/modernizr-2.7.1.min.js"></script>
	<script type="text/javascript" src="o/js/owl.carousel.min.js"></script>
	<script type="text/javascript" src="o/js/jquery.countdown.min.js"></script>
	<script type='text/javascript' src='o/js/jquery.prettyPhoto.js'></script>
	<script type='text/javascript'
		src='o/js/jquery.prettyPhoto.init.min.js'></script>
	<script type="text/javascript" src="o/js/script.js"></script>
</body>
</html>